<template lang="pug">
  .zgplugin-picupload.zgplugin-empty(v-if="(!exist || !show)&&editor")
    svg-icon.empty-icon(icon-class="组件图片上传")
  el-form-item.zgplugin-picupload(v-show="show" v-else-if="exist" :class="config.label?'':'form-label-hidden'"  :label="config.label" :prop="config.propertyName" :rules="rules")
    div.upload-border
      el-upload(:show-file-list='false' accept="image/png, image/jpeg" :is-mobile='isMobile' class="upload-demo" :disabled="readonly" :on-remove='handleRemove' :on-change="handleChange" action=""
      multiple :http-request="uploadFile")
        el-button(:disabled="readonly" size="small" type="primary" style="margin-left:4px;padding:9px 10px")
          | 选择图片
          i(class="el-icon-upload el-icon--right")
        span.picture-name(v-if="rootForm.properties[config.propertyName]") 上传成功
        //- span.picture-name {{rootForm.properties[config.propertyName] ? rootForm.properties[config.propertyName][0].name : ''}}
</template>

<script>
import renderCommon from '../common/renderCommon'

export default {
  mixins: [renderCommon],
}
</script>
<style lang="scss">
.zgplugin-picupload {
  margin-top: 16px;
  margin-bottom: 0 !important;
  .upload-border {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    .picture-name {
      margin-left: 10px;
    }
  }
}
</style>
